using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using Facebook.Web;
using Facebook.Api.DemoSite.Models;
using System.Text;

namespace Facebook.Api.DemoSite.Controllers
{
    public class AuthController : Controller
    {
        public FacebookWebContext GetFacebookContext()
        {
            if (FacebookWebContext.Current == null) FacebookWebContext.Current = new FacebookWebContext("5e6c33fa1dcdb5b223a1a04d64c2eba6", "31a0f9c46a00dca8c3d9e033b499920e");
            return FacebookWebContext.Current;
        }

        public ActionResult Revoke()
        {
            var fb = this.GetFacebookContext();

            fb.Auth.RevokeAuthorization(Int64.Parse(this.Request.Params["fb_sig_user"]));
            fb.Session.Expires = DateTime.Now;

            return new FbRedirectResult("http://apps.facebook.com/dotnetapi/");
        }
    }
}